﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Repetition.Domain;

namespace Repetition.Views
{
    public partial class AddSubjectDialog : Form
    {
        public AddSubjectDialog()
            : this(new Subject()) { }

        public AddSubjectDialog(Subject subject)
        {
            InitializeComponent();

            nameTextbox.Text = subject.Name;
            detailsTextbox.Text = subject.Details;
        }

        public Subject Subject
        {
            get
            {
                return new Subject(nameTextbox.Text, detailsTextbox.Text);
            }
        }

        private void addButton_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            this.Close();
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
